package com.github.io.enums;

import org.springframework.web.bind.annotation.RequestMethod;

/**
 * @author liry
 * @version 1.0
 * @date Created on 2022/9/15 13:43
 * Description:
 */
public enum RequestMethodEnum {
    GET("1", RequestMethod.GET),
    POST("2", RequestMethod.POST),
    PUT("3", RequestMethod.PUT),
    DELETE("4", RequestMethod.DELETE);

    /**
     * 类型
     */
    private String type;
    /**
     * 枚举值
     */
    private String value;

    RequestMethodEnum(String type, RequestMethod requestMethod) {
        this.type = type;
        this.value = requestMethod.name();
    }

    public static RequestMethodEnum getRequestMethodEnum(String type){
        RequestMethodEnum[] enums = RequestMethodEnum.values();
        for (RequestMethodEnum anEnum : enums) {
            if ( anEnum.type.equals(type)){
                return anEnum;
            }
        }
        return null;
    }
    
    
    public final String getValue() {
        return this.value;
    }
}
